import numpy as np
import cv2
 
# 设置图像的大小和颜色通道
height = 480
width = 640
 
# 创建一个全黑的图像
image = np.zeros((height, width, 3), dtype=np.uint8)
 
# 设置正弦波参数
A = 50  # 振幅
B = height/4  # 波的中心
C = 10  # 波的波长
D = 100  # 波的频率
 
# 生成正弦波形的数据
t = 0
tmp = []
old_y = 0
for y in range(height): 
    t = t + 1
    if y - old_y < 8:
        continue

    x = int(A * np.sin(2 * np.pi * y / D + B) + width/2)
    #cv2.line(image, (x, width-1), (y, x), (255, 255, 255), 1)
    cv2.circle(image, (x, y), 3, (0, 0, 255), -1)

    old_y = y
    tmp.append([x,y])
    print(x, y)


print(len(tmp))
print(t)

# 显示图像
cv2.imshow('Sine Wave', image)
cv2.waitKey(0)
cv2.destroyAllWindows()